import React, { useEffect, useState } from 'react'
import NavTabsLayout from '../_Layout/NavTabsLayout'
import TopicBanner from '../../widgets/Banner/TopicBanner'
import ImgWaterfall from '../../widgets/Waterfall/ImgWaterfall'
import TopicAllBanner from '../../widgets/Banner/TopicAllBanner'
import TopicWaterfall from '../../widgets/Waterfall/TopicWaterfall/inedx'
import { TopicService } from '../../transfer/service/TopicService'

export default function Topic(props: any) {
    // 获取当前专题所有图片
    useEffect(() => {
        new TopicService().getTopicImg(props.params.type, 0, 100).then(res => {
            // console.log(res.data.data)
        })
    }, [props.params.type])

    return (
        <NavTabsLayout>
            {props.params.type == 'all' ? (
                <>
                    <TopicAllBanner />
                    <TopicWaterfall type={'topic'} />
                </>
            ) : (
                <>
                    <TopicBanner type={props.params.type} />
                    <ImgWaterfall count={3} type={'topic'} topicId={props.params.type} />
                </>
            )}
        </NavTabsLayout>
    )
}
